﻿using System.Collections.Generic;
using System.Linq;
using Conference.Core.BL.Entities;

namespace Conference.Core.Dal
{
    public partial class SessionRepository
    {
        public IEnumerable<SpeakerEntity> GetSpeakers(SessionEntity session)
        {
            return (from r in
                        (from r in Repositories.SessionSpeaker.GetTable()
                         where r.SessionId == session.Id
                         group r by r.SessionId)
                    join re in Repositories.Speaker.GetTable() on r.Key equals re.Id
                    orderby re.Name
                    select re);
        }
    }
}

